<?php
//session_start();
?>
<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/rspinf-usb/formatoPagina/encabezado.php') ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/rspinf-usb/formatoPagina/menu.php') ?>
<?php require_once($_SERVER['DOCUMENT_ROOT'] . '/rspinf-usb/formatoPagina/inicioContenido.php') ?>
<h1> <br /><br />Editar Materias Cursadas<br /><br /></h1>


<?php
require_once("MateriasFachada.php");
$materiasFachada = MateriasFachada::getInstance();
$user = $_POST["user"];
$perfilPath = "/rspinf-usb/perfil/verPerfil.php?userq=$user";
echo("<a href=\"$perfilPath\">Volver</a>");
echo("</br></br>");
$materiasArray = $materiasFachada->verMateriasCursadas($user);
$htmlTable = "<table id=\"tablaMaterias\" style=\"border: solid 1px\">
            <tr>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Codigo</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Nombre</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Departamento</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Mes Inicial</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Mes Final</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Año</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Nombre Profesor</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Apellido Profesor</th>
            <th style=\"border-right-style: solid;border-bottom-style: solid;border-width: 2px\">Calificación</th>
            <th>   </th>
            <th>   </th>
            </tr>";
foreach ($materiasArray as $row) {
    $htmlTable .= "<tr>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[0]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[1]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[3]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[4]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[5]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[6]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[7]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[8]</td>
                        <td style=\"border-right-style: solid;border-bottom-style: solid;border-width: 1px\">$row[9]</td>
                        <td style=\"border-right-style: solid;border-top-style: solid;border-bottom-style: solid;border-width: 1px\"><form action= 'editarMateriaForm2.php' method='post'>
                        <input type='hidden' name='user' value='{$user}' maxlength='15' /> 
                        <input type='hidden' name='codigo' value='{$row[0]}' maxlength='7' /> 
                        <input type='hidden' name='nombreMateria' value='{$row[1]}' maxlength='30' /> 
                        <input type='hidden' name='mesIni' value='{$row[4]}' maxlength='15' /> 
                        <input type='hidden' name='mesFin' value='{$row[5]}' maxlength='15' /> 
                        <input type='hidden' name='anio' value='{$row[6]}' maxlength='4' /> 
                        <input type='hidden' name='nombreP' value='{$row[7]}' maxlength='15' /> 
                        <input type='hidden' name='apellidoP' value='{$row[8]}' maxlength='15' /> 
                        <input type='hidden' name='calificacion' value='{$row[9]}' maxlength='2' /> 
                        <input type='submit' value='Editar' />
                        </form><td>
                        <td style=\"border-right-style: solid;border-top-style: solid;  border-bottom-style: solid;border-width: 1px\"><form action= 'EliminarMateria.php' method='post'>
                        <input type='hidden' name='user' value='{$user}' maxlength='15' /> 
                        <input type='hidden' name='codigo' value='{$row[0]}' maxlength='7' /> 
                        <input type='hidden' name='mesIni' value='{$row[4]}' maxlength='15' /> 
                        <input type='hidden' name='mesFin' value='{$row[5]}' maxlength='15' /> 
                        <input type='hidden' name='anio' value='{$row[6]}' maxlength='4' /> 
                        <input type='submit' value='Eliminar' />
                        </form><td style=\"border-right-style: solid;border-top-style: solid;border-bottom-style: solid;border-width: 1px\">
                        </tr>";
}

$htmlTable .= "</table> <br /><br /><br /><br /><br /><br />";
echo($htmlTable);
?>

<?php require_once($_SESSION['dir'] . '/formatoPagina/finContenido.php') ?>

